// Copyright 2010 Abhishek Kulkarni. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package goprop

import (
	"math"
)

func isFloat(i interface{}) bool {
	_, ok := i.(float64)
	return ok
}

func square(a float64) float64 {
	return (a * a)
}

func sqrt(a float64) float64 {
	return float64(math.Sqrt(float64(a)))
}

func add(a, b float64) float64 {
	return (a + b)
}

func sub(a, b float64) float64 {
	return (a - b)
}

func mul(a, b float64) float64 {
	return (a * b)
}

func div(a, b float64) float64 {
	return (a / b)
}

func merge(a, b float64) float64 {
	var ret float64
	if a == b {
		ret = a
	} else {
		Error("merge failed. (%v != %v)\n", a, b)
	}
	return ret
}
